]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/brightness: Hide when proxy has no owner
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 30 Jul 2022 12:34:12 +0000 (14:34 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 1 Aug 2022 12:33:36 +0000 (12:33 +0000)
Properties are null while a proxy has no owner. Javascript helpfully
coerces that into `Number(null)` (a.k.a. 0), so we end up with a
broken slider.

Explicitly check that the value is an integer before doing the
comparison to catch that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>

js/ui/status/brightness.js

index aa60206603ee4af049dae38c2f1e5952afd4950e..61258bd59e31352662d2cd0d4388f049c3325e37 100644 (file)
@@ -67,7 +67,8 @@ class Indicator extends PanelMenu.SystemIndicator {
     }
 
     _sync() {
-        let visible = this._proxy.Brightness >= 0;
+        const brightness = this._proxy.Brightness;
+        const visible = Number.isInteger(brightness) && brightness >= 0;
         this._item.visible = visible;
         if (visible)
             this._changeSlider(this._proxy.Brightness / 100.0);